using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThrowAttack : MonoBehaviour
{


    private CommonAttack commonAttack;
    private Character character;

    void Start()
    {
        commonAttack = GetComponentInChildren<CommonAttack>();
        character = transform.parent.GetComponentInParent<Character>();
    }


    public void SetControlledLocation(string pos)
    {
        commonAttack.enemyCharacter.Grasped = true;
        string[] posArray = pos.Split(",");
        Vector2 newPos = new Vector2(transform.position.x + float.Parse(posArray[0]) * character.GetScaleX(), transform.position.y + float.Parse(posArray[1]) * character.GetScaleX());
        commonAttack.enemyCharacter.SetGraspLocation(newPos, float.Parse(posArray[2]), character.GetScaleX());
    }

    public void ThrowExit(string throwAttr)
    {
        string[] attrArray = throwAttr.Split(",");
        commonAttack.enemyCharacter.Grasped = false;
        commonAttack.enemyCharacter.BlowUp(float.Parse(attrArray[0]), float.Parse(attrArray[1]), int.Parse(attrArray[2]) * character.GetScaleX());
    }


}